package com.tgy.leetcode;

/**
 * @Author: tgy
 * @Date: 12/23/20 6:00 PM
 */
public class _找的数组中只有两个数出现奇数次数的这两个数 {

    public static void findOddCountNumber(int[] nums){


         int eor = 0;

        for (int num : nums) {

            eor ^= num;
        }

        int eorRightOne = eor & ((~eor) + 1);

        int oeor = 0;
        for (int num : nums) {

            if ((num & eorRightOne) != 0) {

                oeor ^=num;
            }
        }

        System.out.println(oeor);
        System.out.println(eor ^ oeor);

    }

    public static void main(String[] args) {

        findOddCountNumber(new int[]{4,1,4,6});
    }

}
